{% extends 'cms/base.html' %}

{% block title %}
统计报表
{% endblock %}

{% block content %}

    <div class="row">
        <div class="col-md-12">
            <!-- RECENT PURCHASES -->
            <div class="panel">
                <div class="panel-heading" style="max-height: 130px">
                    <h3 class="panel-title"><strong>报表</strong></h3>
{#                    <div class="right">#}
{#                    </div>#}
                    <form>
                        <table class="table table-hover" style="margin-top: 25px;">
                        <thead>
                        </thead>
                        <tbody>
                            <tr>
                                <td><select class="form-control" name="order">
                                    <option>==选择排序方式==</option>
                                    <option value="sanum">按销售量排序</option>
                                    <option value="salesamount">按销售额排序</option>
                                </select></td>
                                <td><input type="date" placeholder="起始日期" name="start" class="form-control"></td>
                                <td><input type="date" placeholder="结束日期" name="end" class="form-control"></td>
                                <td><input type="submit" value="查询" class="btn btn-primary"></td>
                            </tr>
                        </tbody>
                        </table>
                    </form>

                </div>
                <div class="panel-body no-padding" style="overflow-x: auto;overflow-y: auto;height: 450px">
                    <table class="table table-striped">
                        <thead>
                            <tr>
                                <th>书籍号</th>
                                <th>书名</th>
                                <th>销量数量</th>
                                <th>剩余数量</th>
                                <th>作者</th>
                                <th>出版社</th>
                                <th>进价</th>
                                <th>售价</th>
                            </tr>
                        </thead>
                        <tbody>
                        {% for item in monthlyReport %}
                            <tr>
                                <td>{{ item[0] }}</td>
                                <td>{{ item[1]|truncate(20, '...') }}</td>
                                <td>{{ item[2] }}</td>
                                <td>{{ item[3] }}</td>
                                <td>{{ item[4] }}</td>
                                <td>{{ item[5] }}</td>
                                <td>¥{{ item[6] }}</td>
                                <td>¥{{ item[7] }}</td>
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                </div>
                <div class="panel-footer">
                    <div class="row">
                        <div class="col-md-6">
                            <span class="panel-note" style="font-size: medium"> <strong>销售总量:</strong>{{ saleNumber }} </span>
                        <span class="panel-note" style="margin-left: 20px; font-size: medium"><strong>销售总额：</strong>¥{{ saleAmount }}</span>
                        </div>
                        <div class="col-md-6 text-right">
                            <form action="{{ url_for('cms.generateReport') }}">
                                <input type="text" value="{{ order }}" name="order" style="display: none">
                                <input type="text" value="{{ start }}" name="start" style="display: none">
                                <input type="text" value="{{ end }}" name="end" style="display: none">
                                <input type="submit" class="btn btn-primary" value="生成文件">
                            </form>
                        </div>
                    </div>
                </div>


            </div>
            <!-- END RECENT PURCHASES -->
        </div>

    </div>

{% endblock %}
